package com.company.oa.meeting.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.company.oa.meeting.entity.Meeting;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

import java.time.LocalDateTime;
import java.util.List;

/**
 * 会议Mapper接口
 */
@Repository
public interface MeetingMapper extends BaseMapper<Meeting> {
    /**
     * 分页查询会议列表（包含会议室名称）
     */
    IPage<Meeting> selectMeetingPage(Page<Meeting> page, @Param("meeting") Meeting meeting);
    
    /**
     * 查询指定时间段内会议室是否被占用
     */
    List<Meeting> checkRoomOccupied(@Param("roomId") Long roomId, 
                                    @Param("startTime") LocalDateTime startTime, 
                                    @Param("endTime") LocalDateTime endTime,
                                    @Param("excludeMeetingId") Long excludeMeetingId);
    
    /**
     * 查询用户参与的会议
     */
    IPage<Meeting> selectUserMeetings(Page<Meeting> page, @Param("userId") Long userId, @Param("status") Integer status);
    
    /**
     * 查询会议详情（包含会议室、参与人员、纪要、附件）
     */
    Meeting selectMeetingDetail(@Param("id") Long id);
} 